<include file="__THEME__/header" />
<link rel="stylesheet" href="../Public/gift.css" type="text/css" charset="utf-8" />
<script src="../Public/js/gift.js" type="text/javascript"></script>
<script type="text/javascript">
var url = '__URL__';
$(function(){
		selectItems(1);
		<php>if($_GET["uid"] && $_GET['uid'] != $mid){</php>
			//指定发给某人
			var uid = {.uid}?{.uid}:"";
			if(uid){
				$(".ui-fs-input").remove();
				var image = "{$toUserFace}";
				var name  = "{$toUserName}";
				$(".ui-fs-result").append("<a href='javascript:void(0)' ><img width='20' height='20' src='" + image + "' title='" + name + "' alt='' />" + name + "</a>");
	            $("#ui_fri_ids").val(uid);
			}   
	<php>}</php>
});
function selectItems(id){
	$('.gift_items').each(function(test){
		$(this).attr('class','gift_items');
	});
	$('.giftblock').each(function(){
		$(this).css('display','none');
	});
	$('#gifts'+id).css('display','block');
	$('#item'+id).attr('class','gift_items on');
}

function sendGift(id){
	var clickid = 'gift'+id;
	$('.gifts').each(function(){
		if($(this).attr('id')==clickid){
			$(this).attr('class','gifts hand on');
		}else{
			$(this).attr('class','gifts hand');
		}
	});
	var temp_gift = $('#gift'+id).clone();
	$('#gift_info').html('');
	$('#gift_info').append(temp_gift.html());
	$('#gift_id').val(id);

	scroller('sendto', 1000);
}
function check(){
	if(!$('#gift_id').val()){
		Alert('请选择礼物');
		return false;
	}
	if(!($('#ui_fri_ids').val())){
		Alert('请选择礼物发送对象');
		return false;
	}
}

Array.prototype.remove = function(s) {   
    for (var i = 0; i < this.length; i++) {   
        if (s == this[i])   
            this.splice(i, 1);   
    }   
}   
  
/**  
 * Simple Map  
 *   
 *   
 * var m = new Map();  
 * m.put('key','value');  
 * ...  
 * var s = "";  
 * m.each(function(key,value,index){  
 *      s += index+":"+ key+"="+value+"\n";  
 * });  
 * alert(s);  
 *   
 * @author dewitt  
 * @date 2008-05-24  
 */  
function Map() {   
    /** 存放键的数组(遍历用到) */  
    this.keys = new Array();   
    /** 存放数据 */  
    this.data = new Object();   
       
    /**  
     * 放入一个键值对  
     * @param {String} key  
     * @param {Object} value  
     */  
    this.put = function(key, value) {   
        if(this.data[key] == null){   
            this.keys.push(key);   
        }   
        this.data[key] = value;   
    };   
       
    /**  
     * 获取某键对应的值  
     * @param {String} key  
     * @return {Object} value  
     */  
    this.get = function(key) {   
        return this.data[key];   
    };   
       
    /**  
     * 删除一个键值对  
     * @param {String} key  
     */  
    this.remove = function(key) {   
        this.keys.remove(key);   
        this.data[key] = null;   
    };   
       
    /**  
     * 遍历Map,执行处理函数  
     *   
     * @param {Function} 回调函数 function(key,value,index){..}  
     */  
    this.each = function(fn){   
        if(typeof fn != 'function'){   
            return;   
        }   
        var len = this.keys.length;   
        for(var i=0;i<len;i++){   
            var k = this.keys[i];   
            fn(k,this.data[k],i);   
        }   
    };   
       
    /**  
     * 获取键值数组(类似Java的entrySet())  
     * @return 键值对象{key,value}的数组  
     */  
    this.entrys = function() {   
        var len = this.keys.length;   
        var entrys = new Array(len);   
        for (var i = 0; i < len; i++) {   
            entrys[i] = {   
                key : this.keys[i],   
                value : this.data[i]   
            };   
        }   
        return entrys;   
    };   
       
    /**  
     * 判断Map是否为空  
     */  
    this.isEmpty = function() {   
        return this.keys.length == 0;   
    };   
       
    /**  
     * 获取键值对数量  
     */  
    this.size = function(){   
        return this.keys.length;   
    };   
       
    /**  
     * 重写toString   
     */  
    this.toString = function(){   
        var s = "";   
        for(var i=0;i<this.keys.length;i++,s+=','){   
            var k = this.keys[i];   
            //s += k+"="+this.data[k];  
            s += this.data[k];    
        }   
        s+="";   
        return s;   
    };   
}   

var map = new Map();
function selectAnswer(pid,user_answer){
	var user_char = user_answer.substring(0,1);
	
	if(map.get(pid)){
		var newStr = pid+":"+user_char;
		map.remove(pid);
	}
	map.put(pid,pid+":"+user_char);
}

function submitAnswer(){
	var submitAnswers = document.getElementById("submitAnswers");
	submitAnswers.value=map.toString();
}
</script>

<div class="content">
  <!-- 内容 begin  -->
  <include file="__THEME__/apps" />
  <div class="main"><!-- 画布 begin  -->
    <div class="page_title">
      <h2><img src="../Public/images/interview.png" />面试</h2>
      <div class="c"></div>
    </div>	
    <div style="padding-left:20px;">
    <form action="__URL__/endExam/" method='post'>
    	<volist name="list" id="interview" key="k">
    		{$k}.{$interview['content']}<br />
	    	<volist name="interview['interviewAnswerList']" id="interviewAnswer">
	    		<input type="radio" name='{$k}' value="{$interviewAnswer['answer']}" onclick="selectAnswer({$interview['id']},'{$interviewAnswer['answer']}')"/>{$interviewAnswer['answer']}</br>
	    	</volist>
    	</volist>
    	<br />
    	<div align="center">
    		<input type="submit" value="考试完毕，提交试卷" onclick="submitAnswer();"/>
    	</div>
    	<input type="hidden" id="count" name="count" value="{$k}"/>
    	<input type="hidden" id="submitAnswers" name="submitAnswers" />
    </form>
    </div>
  </div><!-- 画布 end  -->
  <div class="c"></div>
</div><!-- 内容 end -->
<include file="__THEME__/footer" /> 